package cn.iocoder.yudao.module.api.pay.splitting.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumValuable;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * MallBook分账状态枚举
 *
 * @author 山野羡民
 */
@Getter
@AllArgsConstructor
public enum MallBookSplitStatusEnum implements EnumValuable {

    WAIT(0, "待处理"),
    SUCCESS(1, "成功"),
    FAILURE(2, "失败"),
    CANCEL(3, "取消"),
    ERROR(99, "出错"),
    ;

    @EnumValue
    private final Integer value;
    private final String name;

    public static MallBookSplitStatusEnum valueOf(int value) {
        return Stream.of(MallBookSplitStatusEnum.values())
                .filter(p -> p.value == value)
                .findAny()
                .orElse(WAIT);
    }


}
